﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>军种兵种管理</title>
<script type="text/javascript" src="../../../_data/SysConfig.js"></script>
<script type="text/javascript" src="../../../_libs/jquery-min.js"></script>
<script type="text/javascript" src="../../../_libs/jquery.jtemplates.js"></script>
<script type="text/javascript" src="../../../scripts/jumbotcms.js?v4"></script>
<link type="text/css" rel="stylesheet" href="../../../style/global.css" />
<script type="text/javascript" src="../../../admin/otherpage/styles/common.js"></script>
<link type="text/css" rel="stylesheet" href="../../../admin/otherpage/styles/common.css" />
<script type="text/javascript">
var pagesize=15;
var page=thispage();
function ajaxList(currentpage)
{
	if(currentpage!=null) page=currentpage;
	JumbotCms.Loading.show("正在加载数据,请等待...");
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"page="+currentpage+"&pagesize="+pagesize+"&time="+(new Date().getTime()),
		url:		"ajax.aspx?oper=ajaxGetList",
		error:		function(XmlHttpRequest,textStatus, errorThrown){JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				JumbotCms.Loading.hide();
				$("#ajaxList").setTemplateElement("tplList", null, {filter_data: true});
				$("#ajaxList").processTemplate(d);
				break;
			}
		}
	});
}
function move(id,isUp){
	JumbotCms.Loading.show("正在处理...");
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id+"&up="+isUp,
		url:		"ajax.aspx?oper=move&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				JumbotCms.Alert(d.returnval, "1", "ajaxList("+page+");");
				break;
			}
		}
	});
}
function ConfirmDel(id){
	JumbotCms.Confirm("确定要删除吗？", "ajaxDel("+id+")");
}
function ajaxDel(id){
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"ajax.aspx?oper=ajaxDel&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				ajaxList(page);
				break;
			}
		}
	});
}
</script>

</head>
<body>
    <div class="topnav"> <span class="preload1"></span><span class="preload2"></span>
	<ul id="topnavbar">
		<li class="topmenu"><a href="javascript:void(0);" onclick="JumbotCms.Popup.show('edit.aspx?id=0',-1,-1,true)" id="classadd" class="top_link"><span>增加军种/兵种</span></a>
		</li>
	</ul>
	<script>
	topnavbarStuHover();
    </script>
</div>
<textarea id="tplList" style="display:none">
<table class="listtable" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;">
	<tr>
		<th scope="col" style="width:40px;">ID</th>
		<th scope="col" width="*">军种/兵种名称</th>
		<th scope="col" style="width:100px;">排序</th>
		<th scope="col" style="width:70px;">操作</th>
	</tr>
	{#foreach $T.table as record}
	<tr onMouseOver="this.style.backgroundColor='F3F7FF'" onMouseOut="this.style.backgroundColor='FFFFFF'">
		<td align="center">{$T.record.id}</td>
		<td align="left">
           		{#if $T.record.codelength < 10}
                	<img src="{site.Dir}admin/otherpage/images/li0{$T.record.codelength}.gif" />
            		{#else}
                	<img src="{site.Dir}admin/otherpage/images/li{$T.record.codelength}.gif" />
			{#/if}
			{$T.record.title}
		</td>
		<td align="center">
			<a href="javascript:void(0)" onclick="move({$T.record.id},1)">上升</a> | <a href="javascript:void(0)" onclick="move({$T.record.id},-1)">下降</a>
		</td>
		<td align="center">
			<a href="javascript:void(0);" onclick="JumbotCms.Popup.show('edit.aspx?id={$T.record.id}',-1,-1,true)">修改</a>
			<a href="javascript:void(0);" onclick="ConfirmDel({$T.record.id})">删除</a>
		</td>
	</tr>
	{#/for}
</table>
</textarea>
<div id="ajaxList"> </div>
<div id="ajaxPageBar" class="pages"> </div>
<script type="text/javascript">ajaxList(page);</script>
</body>
</html>
